﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Orders.Api.Infrastructure;
using Orders.Api.Models;
using Orders.Application.Services;

namespace Orders.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class OrdersController : ControllerBase
    {
        private readonly IOrderService service;
        public OrdersController(IOrderService service)
        {
            this.service = service;
        }

        [HttpPost]
        public async Task<IActionResult> CreateOrder(OrderModel model)
        {
            var createOrder= await service.CreateOrder(model.ToOrder());
            return Accepted();
        }
    }
}
